/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package an_sim;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 *
 * @author Karcsi
 */
public class Reader {

public static FullNetwork reader(String arg) throws FileNotFoundException{
    String filePath = arg;
        Policy policy=null;
        List<Integer> nodeNeighboursList=new ArrayList();
        List<Node> nodeList=new ArrayList<Node>();
        int nn=0;
        int noden=0;
            FileInputStream fileInputStream = new FileInputStream(filePath);

            Scanner scan = new Scanner(fileInputStream);
            noden=scan.nextInt();
            for(int j=0; j<noden; j++){
           policy=new Policy( scan.nextInt(), scan.nextInt());
           nn=scan.nextInt();
           for(int i=0; i<nn; i++){
               nodeNeighboursList.add(scan.nextInt()+noden);
           }
           nodeList.add(new Node(policy,nodeNeighboursList));
           nodeNeighboursList.clear();
            }
            return new FullNetwork(nodeList);

}
}
